<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>A端登陆 | 大象与猩猩</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="alternate icon" type="image/png" href="assets/i/favicon.png">
<link rel="stylesheet" href="assets/css/amazeui.min.css" />
<link rel="stylesheet" href="js/sweet-js/sweet-alert.css">
<style>
.header {
	text-align: center;
}

.header h1 {
	font-size: 200%;
	color: #333;
	margin-top: 30px;
}

.header p {
	font-size: 14px;
}
</style>
</head>
<body onload="start()">
	<div class="header">
		<div class="am-g">
			<h1>Web ide</h1>
			<p>
				Fruit. Life<br />水果-生活
			</p>
		</div>
		<hr />
	</div>
	<div class="am-g">
		<div class="am-u-lg-6 am-u-md-8 am-u-sm-centered">
			<h3>A端登录</h3>
			<hr>
			<div class="am-btn-group">
				<a href="#" class="am-btn am-btn-secondary am-btn-sm"><i
					class="am-icon-lemon-o am-icon-sm"></i> 水果</a> <a href="#"
					class="am-btn am-btn-success am-btn-sm"><i
					class="am-icon-user-plus am-icon-sm"></i> 生活+</a> <a href="#"
					class="am-btn am-btn-primary am-btn-sm"><i
					class="am-icon-angellist am-icon-sm"></i> 健康</a>
			</div>
			<br> <br>

			<form id="loginForm" class="am-form" name="">
				<label for="phone">手机号:</label> <input required placeholder="请输入手机号"
					maxlength="11" type="tel" name="phone" id="phone" value="">
				<br> <label for="password">密码:</label> <input required
					type="password" placeholder="请输入密码" name="password" id="password"
					value=""> <br> <label for="remember-me"> <input
					onchange="rememberMe()" id="remember-me" type="checkbox">
					记住手机号
				</label> <br />
				<div class="am-cf am-margin-top-xs">
					<input id="login" type="submit" name="" value="登 录"
						class="am-btn am-btn-primary am-btn-sm am-fl"> <a
						href="b-getback.html" id="forgetPassword"
						class="am-btn am-btn-default am-btn-sm am-fr">忘记密码 ^_^? </a>
				</div>
			</form>
			<hr>
			<p>© 2014-2016 dxyxx, Inc. 浙ICP备14017672号</p>
		</div>
	</div>

	<script type="text/javascript" src="../resources/js/zepto1.1.6.min.js"></script>
	<script type="text/javascript" src="js/sweet-js/sweet-alert.js"></script>
	<script type="text/javascript">
		function start() {
			if (window.localStorage) {
				var phone = localStorage.getItem("phone", phone);
				if (phone != null) {
					$('#phone').val(phone);
					$("#remember-me").prop("checked", true);
				}
			}
		};
		function rememberMe() {
			var phone = $('#phone').val();
			if (phone == "") {
				sweetAlert("请输入电话号码");
				$("#remember-me").prop("checked", false);
				return;
			} else {
				if (window.localStorage) {
					if ($("#remember-me").attr("checked") == true) {
						localStorage.setItem("phone", phone);
					} else {
						localStorage.removeItem("phone");
					}
				} else {
					sweetAlert('无法保存');
				}
			}
		}
		$('form').submit(function() {
			event.preventDefault();
			$.ajax({
				type : "POST",
				url : "../adminlogin",
				data : $("#loginForm").serialize(),
				dataType : "json",
				success : function(data) {
					if (data.code == 1) {
						window.location.href="admin-index.html";
					} else {
						sweetAlert('手机号或者密码有误！');
					}
				},
				error : function(data) {
				}
			});
		});
	</script>
</body>
</html>